1. Field of the Invention
The present invention relates generally to an improved data processing system and in particular, to a computer implemented method and apparatus for managing web applications. More particularly, the present invention is directed to a computer implemented method, apparatus, and computer usable program product for storing Hypertext Transfer Protocol (HTTP) session data in a browser to introduce states in object oriented programming language-based Web applications.
2. Description of the Related Art
The content of a JAVA™-based web page is dynamically generated by a web application in response to receiving a request from a client browser. The requested content is then presented to the browser in a response page. The exchange of requests and response pages may occur via Hypertext Transfer Protocol.
Hypertext Transfer Protocol is a communications protocol used to exchange information on the World Wide Web. Specifically, Hypertext Transfer Protocol is a stateless request/response protocol for exchanging information between clients and servers. A stateless protocol is a protocol that treats each request as an independent transaction unrelated to previous requests. One consequence of statelessness is that a web application is unable to correlate different, related requests that originate from a single browser. For example, if a user selects a series of items on one web page and navigates to another web page, the selected items will be lost.
Session data is persistent data that is maintained during a session to correlate one request to another. The session data consists of session variables generated by the web application while the user navigates the pages of the web application. The session data may identify a user's preferences or prior selections. Session data is identified by a session ID that relates to a series of related requests and responses between clients and servers. Thus, a subsequent exchange of requests and responses of a communications session may be associated with one another. For example, a buyer visiting a seller's web site may select items for purchase. The items may be placed in a virtual shopping cart, which is implemented as session data, as the items are found on the web site. The buyer may then proceed to a checkout page. This interaction involves an ongoing exchange of messages: requests from the client and responses from a server. The session ID enables the web server to keep track of the items placed in the buyer's virtual shopping cart.
One currently used method for persisting session data is by storing session data in cookies. Cookies are text files stored on a user's computer by a web browser at the request of a web application. This type of data is stored on a persistent storage, such as a hard disk drive. Cookies include information to identify clients that have previously interacted with the web application. Thus, in response to subsequent requests to a web application by a client browser, a web application may retrieve the session data. However, a common problem associated with the use of cookies that browser settings may prevent the storage of cookies. Another problem may be the intentional or unintentional removal of stored cookies by users. Further, the cookies are stored in memory. Consequently, the server's available memory and other resources may be rapidly depleted, especially in the instance where a large number of unique users are engaged in a communications session with the web application.
Another currently used method for persisting session data is the implementation of URL rewriting. A uniform resource locator (URL) is an Internet address. Uniform resource locator rewriting is a process by which the URL is modified to include a session ID. Web applications may then use the session ID to identify the session data stored in memory. However, memory is also used for each session. Thus, a common problem with URL rewriting is the depletion of server resources. In addition, session data stored in memory, either via URL rewriting or cookies, may be subject to session replication. Session replication is the replication of session data created on one node is made available to all other nodes. Session replication consumes additional server resources. In addition, errors in session data replication may prevent the web application from working properly.
Another currently used method for persisting session data is the storage of session data in a database. In this method, the database stores session data that can be correlated to a session ID stored in a cookie or in a URL that has been modified by URL rewriting. However, a problem associated with databases for storing session data is that databases are more expensive to use and may result in additional costs associated with database maintenance. In addition, retrieval of session data from a database is slower than retrieval of session data from memory. Further, database failure or database maintenance that may prevent access to the database renders the session data unavailable.
The currently used methods identified above for persisting session data have well known problems associated therewith as identified above. Therefore, it would be advantageous to have a method and apparatus for creating, storing, and retrieving session data in a manner that overcomes the above described problems.